﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TextController : MonoBehaviour
{

    public Transform player;
    public Transform boss;

    Text[] text;

    void Start()
    {
        text = GetComponentsInChildren<Text>();
    }

    void Update()
    {
        if (player != null)
        {
            if (player.GetComponent<PlayerController>().hp <= 0)
            {
                foreach (var item in text)
                {
                    item.text = "You Died";
                }
            }
        }
        

        if (boss == null)
        {
            foreach (var item in text)
            {
                item.text = "You Win";
            }
        }
    }
}
